package com.smart.lib.controller;

import com.smart.lib.entity.AdminInfo;
import com.smart.lib.service.AdminService;
import com.smart.lib.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 管理员控制器层
 * */
@RestController
@CrossOrigin
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    AdminService adminService;
    /**
     * 管理员登录方法
     * */
    @RequestMapping(value = "/validateAdmin", method = RequestMethod.POST, produces = "application/json; utf-8")
    public Response validateAdmin(@RequestBody AdminInfo adminInfo){
        return adminService.validateAdmin(adminInfo);
    }

    /**
     * 管理首页获取图书基础信息数据
     * */
    @RequestMapping(value = "/getCurrentLibData", method = RequestMethod.GET, produces = "application/json; utf-8")
    public Response getCurrentLibData(){
        return adminService.getCurrentLibData();
    }
}
